<template>
<section class="view">
  <div class="news_title">
    资讯首页
  </div>
  <div class="news_list flex">
    <ul class="content">
      <li v-for="item in paramsNews" class="flex">
        <div class="title" @click="goDetail(item)">{{ item.title }}</div>
        <div class="time">{{ dateformat(item.createTime) }}</div>
      </li>
    </ul>

  </div>
</section>
</template>

<script>
	import newsDetail from './detail/index.vue'
  import dateformat from '../../assets/js/index'
  export default {
    data () {
      return {
      	paramsNews: [],
        dateformat: dateformat
      }
    },
    beforeMount() {
    	this.require_newsList()
    },
    methods: {
      goDetail (mes) {
        this.$router.push('/news/detail/' + mes.id)
      },
      require_newsList () {
      	this.$api.newsList().then(res => {
      		this.paramsNews = res.data.list
      	})
      }
    },
    components: {
    	'news-detail': newsDetail
    }

  }
</script>

<style lang="less" scoped>
   section{
     margin-top: 20px;
   }
  .news_title{
    height: 48px;
    line-height:48px;
    text-align: left;
    padding-left: 40px;
    font-size: 17px;
    font-weight: bold;
    letter-spacing: 5px;
    color: red;
    background: url("../../../static/img/news_bg.gif") 0 0 no-repeat;
  }
  .content{
    width: 700px;
    border: 2px solid #f9b555;
    li{
      padding:10px 8px;
      color: #1f376d;
      text-align: left;
      font-size: 14px;

      .title{
        display: inline-block;
        cursor: pointer;

      }
      .title:hover{
        color: red;
        border-bottom: 1px solid red;
        margin-bottom: -1px;
      }
      .time{
        flex: 1;
        text-align: right;
        padding-right: 20px;
        color: #888;
      }
    }
  }
</style>

